cmake_minimum_required(VERSION 3.14)
project(CrashHandler)

# 添加静态库
add_library(${PROJECT_NAME} STATIC
    CrashHandler.cpp
    CrashHandler.hpp
)

target_include_directories (${PROJECT_NAME} PRIVATE  
    ${CMAKE_SOURCE_DIR}/vendor/crashpad
    ${CMAKE_SOURCE_DIR}/vendor/mini_chromium
)

# 检测目标是否为 STATIC，如果不是则定义宏
target_compile_definitions(${PROJECT_NAME} PRIVATE
    $<$<BOOL:${BUILD_SHARED_LIBS}>:BUILD_CRASHHANDLER_DLL>
    $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:BUILD_CRASHHANDLER_STATIC>
)

add_definitions(-DNOMINMAX)


# 链接 Crashpad 的库
target_link_libraries(${PROJECT_NAME} PRIVATE crashpad_client crashpad_compat crashpad_minidump crashpad_snapshot crashpad_tools crashpad_util mini_chromium)
